<?php require_once ADMINVIEWPATH.'admin_header.php'; ?>
<?php require_once ADMINVIEWPATH.'admin_menu.php'; ?>
<!-- Page Content -->
            <div class="page-content">
                <!-- Page Breadcrumb -->
                <div class="page-breadcrumbs">
                    <ul class="breadcrumb">
                        <li>
                            <i class="fa fa-home"></i>
                            <a href="/luckydog/index">首页</a>
                        </li>
                        <li >
                            <a href="#">意见反馈管理</a>
                        </li>
                        <li class="active">
                            意见反馈列表
                        </li>
                    </ul>
                </div>
                <!-- /Page Breadcrumb -->
                <!-- Page Body -->
                <div class="page-body">
                    <div class="row">
                        <div class="col-xs-12 col-md-12">
                            <div class="tab-content tabs-flat no-padding">
                                <div id="visits" class="tab-pane active animated fadeInUp">
                                    <div class="row">
                                        <div class="col-lg-12 chart-container">
                                            <div id="dashboard-chart-visits" class="chart chart-lg no-margin">
                                                
                                                <div class="widget-body">
                                                        <div style="float: left;">
                                                            <div class="pull-left" style="line-height: 30px;margin-left: 10px;margin-bottom: 20px;">开始时间：</div>
                                                            <input class="form-control" style="width:100px;" type="text" placeholder="起始时间" id="starttime" onClick="WdatePicker({maxDate:'#F{$dp.$D(\'endtime\')||\'2120-10-01\'}'})" value="">
                                                        </div>
                                                        <div style="float: left;">
                                                            <div class="pull-left" style="line-height: 30px;margin-left: 10px;margin-bottom: 20px;">结束时间：</div>
                                                            <input class="form-control" style="width:100px;" type="text" placeholder="起始时间" id="endtime" onClick="WdatePicker({minDate:'#F{$dp.$D(\'starttime\')}',maxDate:'2120-10-01'})" value="">
                                                        </div>
                                                        <div style="float: left; padding-left:10px;">
                                                            <div class="pull-left" style="line-height: 30px;margin-left: 10px;margin-bottom: 20px;">关键字：</div>
                                                            <input class="form-control" style="width:100px;" placeholder="内容" id="contents" type="text">
                                                        </div>
                                                        
                                                        <div style="float: left; padding-left:10px;">
                                                            <div class="pull-left" style="line-height: 30px;margin-left: 10px;margin-bottom: 20px;">手机号：</div>
                                                            <input class="form-control" style="width:150px;" placeholder="反馈人/手机号" id="contact" type="text">
                                                        </div>
                                                        <div class="control-group"  style="float: left; padding-left:10px;">
                                                            <div class="controls" >
                                                                <select id="choosestatus" style="width: 150px;">
                                                                        <option value = "">不限</option>
                                                                        <option value = "0">未处理</option>
                                                                        <option value = "1">已处理</option>
                                                                </select>
                                                            </div>
                                                        </div>
                                                        <div style="float: left;">
                                                            <a class="btn J_search" href="javascript:;">搜索</a>
                                                        </div>
                                                        <div class="widget-title"> <span class="icon"><i class="icon-th"></i></span>
                                                            <h5 style="float: right">共有数据：<?= $total_rows;?>条</h5>
                                                        </div>
                                                        <table class="table table-striped table-bordered table-hover" id="simpledatatable">
                                                            <thead>
                                                                <tr>
                                                                      <th>序号</th>
                                                                      <th>内容</th>
                                                                      <th>反馈人ID</th>
                                                                      <th>联系方式</th>
                                                                      <th>日期</th>
                                                                      <th>状态</th>
                                                                      <th>操作</th>
                                                                </tr>
                                                            </thead>
                                                            <tbody>
                                                            
                                                            <?php if(!empty($feedbackList)):?>
                                                            <?php foreach($feedbackList as $key=> $row):?>
                                                            <tr class="gradeX">
                                                                    <td class="center" style="text-align:center;width:40px;"><?= $key+1;?></td>
                                                                    <td class="center"><?= $row['content']?></td>
                                                                    <td class="center"><?=  $row['feedbackperson']?$row['feedbackperson']:"--"?></td>
                                                                    <td class="center"><?=  $row['fromUsername']? $row['fromUsername']:"--"?></td>
                                                                    <td class="center"><?=  date("Y-m-d h:i:s",$row['addtime'])?></td>
                                                                    <td class="center">
                                                                        <?php if($row['status'] == 0){?>
                                                                            未处理
                                                                        <?php }else{?>
                                                                            已处理
                                                                        <?php }?>
                                                                    </td>
                                                                    <td class="center " data_status="<?= $row['status'];?>" data_id = "<?= $row['id'];?>">
                                                                        <?php if(check_authorize("Feedback","List","delete")):?>
                                                                        <a href="javascript:;" class="J_del">删除</a></br>
                                                                        <?php endif;?>
                                                                        <?php if(check_authorize("Feedback","List","verify")):?>
                                                                        <?php if($row['status'] == 0){?>
                                                                             <a href="javascript:;" class="edit_status" data_status = "1">未处理</a>
                                                                        <?php }?>
                                                                        <?php endif;?>
                                                                    </td>
                                                             </tr>
                                                        <?php endforeach;?>
                                                        <?php endif;?>
                                                         <tr>
                                                            <td align='center' colspan="7">
                                                                <div class="page_links"><?= $page_links?></div>
                                                            </td>
                                                          </tr>
                                                               
                                                            </tbody>
                                                        </table>
                                                    </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!-- /Page Body -->
        </div>
        <!-- /Page Content -->
<script src="<?= STATICURL; ?>js/jquery-2.0.3.min.js"></script>
<script src="<?= STATICURL; ?>layer/layer.js"></script>
<script src="<?= STATICURL; ?>js/wdatepicker/WdatePicker.js"></script>
<?php require_once ADMINVIEWPATH.'admin_footer.php'; ?>
<script>
    $(document).ready(function() {
    $(".J_search").click(function(){
        var endtime = $("#endtime").val();
        var starttime = $("#starttime").val();
        var contents = $("#contents").val();
        var contact = $("#contact").val();
        var status = $("#choosestatus").val();
        var params={
            'starttime':starttime,
            'endtime':endtime,
            'contents':contents,
            'contact':contact,
            'status':status
        };
        location = "/luckydog/feedback/index?"+$.param(params);
    });
    $(".edit_status").click(function(){
        var id = $(this).parent().attr("data_id");
        var status = $(this).attr("data_status");
        $.post("/luckydog/feedback/edit_status",{id:id,status:status},function(res){
            if(res){
                window.location.reload();
            }else{
                alert("失败");
            }
        });
    });
});
    function edit_status(status){
        var params={
            'status':status,
            'id':id
        };
        location = "/luckydog/feedback/edit_status?"+$.param(params);
    }

$(".J_del").click(function() {
    var id = $(this).parent().attr("data_id");
    if (confirm("您确定要删除吗？")) {
        $.post("/luckydog/feedback/delFeedback", {"id":id}, function(res) {
            if (res == 1) {
                window.location.reload();
            }else{
                alert("删除失败");
            }
        });
    }
});
</script>



